home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / __MANDEL / MANDELBR / CPIXMAPP.C < prev    next >
Text File  |  1992-05-31  |  2KB  |  80 lines

  1. /******************************************************************************
  2.  CPixMapPane.c
  3.  ******************************************************************************/
  4.  
  5. #include "Global.h"
  6. #include "CPixMapPane.h"
  7.  
  8. void    CPixMapPane::IPixMapPane(
  9.     CView            *anEnclosure,
  10.     CBureaucrat        *aSupervisor,
  11.     short            aWidth,
  12.     short            aHeight,
  13.     short            aHEncl,
  14.     short            aVEncl,
  15.     SizingOption    aHSizing,
  16.     SizingOption    aVSizing,
  17.     CPixMap *        aPixMap)
  18. {
  19.     Rect        aBoundsRect;
  20.     
  21.     CPanorama::IPanorama(anEnclosure, aSupervisor,
  22.                      aWidth, aHeight, aHEncl, aVEncl, aHSizing, aVSizing);
  23.     
  24.     itsPixMap = aPixMap;
  25.     itsPixMap->GetBounds(&aBoundsRect);
  26.     QDToLongRect(&aBoundsRect, &bounds);
  27.     position.h = bounds.left;
  28.     position.v = bounds.top;
  29.     
  30.     autoRefresh = FALSE;
  31. }
  32.  
  33. void    CPixMapPane::SetPixMap(
  34.     CPixMap*    aPixMap)
  35. {
  36.     Rect        aBounds;
  37.     LongRect    aLongBounds;
  38.     
  39.     itsPixMap = aPixMap;                /* Set instance variable            */
  40.     itsPixMap->GetBounds(&aBounds);
  41.     QDToLongRect(&aBounds, &aLongBounds);
  42.     SetBounds(&aLongBounds);
  43. }
  44.  
  45. CPixMap*    CPixMapPane::GetPixMap()
  46. {
  47.     return(itsPixMap);
  48. }
  49.  
  50. void    CPixMapPane::Draw(
  51.     Rect        *area)
  52. {
  53.     Rect        aBoundsRect;
  54.     LongRect    lArea;
  55.     
  56.     if (itsPixMap != NULL) {
  57.         itsPixMap->GetBounds(&aBoundsRect);
  58.         SectRect(area, &aBoundsRect, area);
  59.         
  60.         QDToFrameR( area, &lArea);
  61.         itsPixMap->CopyFrom( &lArea, &lArea, NULL);
  62.     }
  63. }
  64.  
  65. PicHandle CPixMapPane::GetPicHandle(void)
  66. {
  67.     PicHandle    aPictH;
  68.     Rect        aBoundsRect;
  69.     LongRect    aLongRect;
  70.     
  71.     Prepare();
  72.     
  73.     itsPixMap->GetBounds(&aBoundsRect);
  74.     aPictH = OpenPicture(&aBoundsRect);
  75.     QDToLongRect(&aBoundsRect, &aLongRect);
  76.     itsPixMap->CopyFrom( &aLongRect, &aLongRect, NULL);
  77.     ClosePicture();
  78.     
  79.     return aPictH;
  80. }